package com.nbjtjc.common.bean;

public enum PLANFREQUENCY {

    NOREPEAT("不重复",0,0),ONEHOUR("1小时",1,3600),TWOHOUR("2小时",2,7200)
    ,FOURHOUR("4小时",144000),EIGHTHOUR("8小时",288000),ONEDAY("每日一次",5,86400)
    ,WEEK("每周一次",6,604800),HALFMONTH("15天一次",7,1209600),MONTH("每月一次",8,2419200)
    ,THREEMONTH("每季度一次",9,7257600);

    private String name;
    private Integer code;
    private Integer timeInterval;
    public static String getName(Integer code){
        for(PLANFREQUENCY planfrequency : PLANFREQUENCY.values()){
            if(planfrequency.getCode().equals(code)){
                return planfrequency.getName();
            }
        }
        return "";
    }

    public static Integer getTimeInterval(Integer code){
        for(PLANFREQUENCY planfrequency : PLANFREQUENCY.values()){
            if(planfrequency.getCode().equals(code)){
                return planfrequency.getTimeInterval();
            }
        }
        return 0;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getTimeInterval() {
        return timeInterval;
    }

    public void setTimeInterval(Integer timeInterval) {
        this.timeInterval = timeInterval;
    }

    PLANFREQUENCY(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    PLANFREQUENCY(String name, Integer code, Integer timeInterval) {
        this.name = name;
        this.code = code;
        this.timeInterval = timeInterval;
    }
}
